﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MMITWeb.Infrastructure.Concrete;
using MMITCore.Abstract;
using MMITCore.Logging;
using Moq;
using MMITWeb.Infrastructure.Abstract;
using MMITWeb.Models;

namespace MMITUnitTests.Web.Infrastructure.Concrete
{
    [TestClass]
    public class NotificationManagerTests
    {
        ILogger<SynkronLogger> mockLogger;
        ITemplatePath mockTemplatePath;

        [TestInitialize]
        public void Initialize()
        {
            var logger = new Mock<ILogger<SynkronLogger>>();
            var templatePath = new Mock<ITemplatePath>();

            templatePath.Setup(p => p.TemplatePath).Returns("~/Views/Shared/EmailTemplates");
            mockLogger = logger.Object;
            mockTemplatePath = templatePath.Object;
        }

        [TestMethod]
        [ExpectedException(typeof(System.IO.DirectoryNotFoundException))]
        public void SendTemplateEmail()
        {
            //arrange
            var target = new NotificationManager(mockLogger, mockTemplatePath);
            target._notificationType = NotificationType.EmailNotification;
            
            var model = new EmailViewModel
            {
                from = "webmaster@mmitonline.com",
                subject = "m-Diaspora Login Information",
                to = new string[] { "dipolash4@gmail.com" },
                from_alias = "webmaster",
                firstname = "oladipo",
                lastname = "olasemo",
                password = "password",
                username = "oladipo"
            };
            //act
            target.SendTemplateEmail(EmailType._Registration, model);

            //assert
            
        }
    }
}
